package priv.bestbeat.reportcenter.admin.config;

import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import priv.bestbeat.reportcenter.core.monitor.MonitorProxy;
import priv.bestbeat.reportcenter.core.monitor.ObservablePersistenceProxy;
import priv.bestbeat.reportcenter.core.monitor.TaskMonitorProxy;
import priv.bestbeat.reportcenter.core.monitor.mybatis.TaskObservableMybatisProxy;
import priv.bestbeat.reportcenter.core.monitor.mybatis.config.CoreMybatisConfig;
import priv.bestbeat.reportcenter.core.mq.MessageProxy;
import priv.bestbeat.reportcenter.core.mq.rocket.SpringRocketMQProxy;

/**
 * @author 张渠钦
 * @date 2022/4/28 9:41
 */
@Configuration
@ImportAutoConfiguration(classes = CoreMybatisConfig.class)
public class MqConfig {

    @Bean
    MessageProxy messageProxy(MonitorProxy monitorProxy) {
        MessageProxy messageProxy = new SpringRocketMQProxy();
        messageProxy.setMonitorProxy(monitorProxy);
        return messageProxy;
    }

    @Bean
    MonitorProxy monitorProxy() {
        return new TaskMonitorProxy();
    }

    @Bean
    ObservablePersistenceProxy observablePersistenceProxy() {
        return new TaskObservableMybatisProxy();
    }
}
